package com.example.epoxystudy;

import com.airbnb.epoxy.AutoModel;
import com.airbnb.epoxy.CarouselModel_;
import com.airbnb.epoxy.TypedEpoxyController;
import com.example.epoxystudy.views.HeaderViewModel_;
import com.example.epoxystudy.views.PageItemViewModel_;

import java.util.List;

public class SampleController extends TypedEpoxyController<List<String>> {

    @AutoModel
    HeaderViewModel_ header;

    @Override
    protected void buildModels(List<String> thumbs) {
        header.title("这是标题").caption("这是caption").addTo(this);

        int page = 1;
        for (String thumb : thumbs) {
            new PageItemViewModel_()
                    .id(page)
                    .image(thumb)
                    .page(page++)
                    .addTo(this);
        }
    }
}
